<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{:lang('添加管理员')}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<body>
    <div class="layui-fluid">
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">{:lang('添加管理员')}</a></legend>
        </fieldset>
        <form class="layui-form" id="form">
            <div class="layui-form-item">
                <label class="layui-form-label">{:lang("名称")}</label>
                <div class="layui-input-inline">
                    <input name="supplier_name" lay-verify="required" autocomplete="off" class="layui-input" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">{:lang("账号")}</label>
                <div class="layui-input-inline">
                    <input placeholder="{:lang('登录账号')}" name="supplier_account" lay-verify="required" autocomplete="off" class="layui-input" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">{:lang("密码")}</label>
                <div class="layui-input-inline">
                    <input placeholder="{:lang('登录密码')}" name="supplier_pwd" lay-verify="required" autocomplete="off" class="layui-input" type="password">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <button class="layui-btn" lay-submit="" lay-filter="create">提交</button>
                </div>
            </div>
        </form>
    </div>
</body>
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    var message;
    layui.config({
        base: '__JS__/',
        version: '1.0.1'
    }).use(['app', 'message','form'], function() {
        var app = layui.app,
            $ = layui.jquery,
            form = layui.form,
            layer = layui.layer;
        //将message设置为全局以便子页面调用
        message = layui.message;
        //主入口
        app.set({
            type: 'iframe'
        }).init();

        form.on('submit(create)',function(){
            console.log($("#form").serialize());
            $.post("{:url('admin/supplier/create')}",$("#form").serialize(),function (res) {
                layer.msg(res.msg);
                if(res.code > 0){
                    setTimeout(function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        //刷新父业
                        parent.location.reload();
                        //关闭当前页
                        layer.close(index);
                    },1000)
                }
            },'json')
            return false;
        })

    });
</script>
</html>